#ifndef __AIDIRECTOR_H__
#define __AIDIRECTOR_H__

#include "cocos2d.h"
#

using namespace cocos2d;

class PlayerPerformance;
class DifficultyFactor;
class SpawnSets;
class CatSpawnScript;

class AIDirector
{
private:

	static const int 	NUM_OF_FACTORS = 4;

	int					_minDifficulty,
						_maxDifficulty,
						_currentDifficulty,
						_spawnDifficulty,
						_propertyDifficulty,
						_spawnPropertyDifficulty;

	float				_period,
						_currentTime;

	PlayerPerformance*	_pPlayerPerformance;

	double				_pWeights[NUM_OF_FACTORS];			 // Initialise weights for difficulty factors
	DifficultyFactor*	_pDifficultyFactors[NUM_OF_FACTORS];
	SpawnSets*			_pSpawnSets;

	//===== FUNCTIONS =====
	bool		canUpdate();					// Check if update can be done
	void		increaseDifficulty(int amount);	// Increase current difficulty
	void		decreaseDifficulty(int amount);	// Decrease current difficulty

	void		initDifficultyFactors();		// Add difficulty factors into array
	void		updateDifficultyFactors();		// Update difficulty factors
	void		updateSpawnSets();				// Update spawn sets
	void		updateDifficultyThreshold();	// Difficulty amount assigned to properties

	void		setSpawnDifficulty();			// Difficulty amount assigned to cat spawn
	void		setPropertyDifficulty();		// Difficulty amount assigned to properties
	void		setSpawnPropertyDifficulty(); 	// Difficulty amount assigned to cat spawn property

public:
	//===== CONSTRUCTOR =====
	AIDirector(int minDifficulty, int maxDifficulty, CCArray* pSpawnSets, PlayerPerformance* pPlayerPerformance); 	//Default constructor

	//===== DESTRUCTOR =====
	~AIDirector(void);

	//===== FUNCTIONS =====
	void		update(float timeDiff);				// Update the info for player's performance

	//===== GETTERS =====
	float		getPeriod()	{ return _period; }
	int			getCurrentDifficulty(){ return _currentDifficulty; }

	int			getDifficultyFactorDifficulty(int index);

	//===== SETTERS =====

};

#endif // __AIDIRECTOR_H__
